let funobj:any = {

}
export const imgonLoad = (funName:string,fun:Function)=>{
  funobj[funName] = {
    fun,
    limit:0
  }
}
export const addlimit = (funName:string = '')=>{
  if(!funobj[funName]) return
  funobj[funName].limit += 1
}
export const reducelimit = (funName:string = '')=>{
  if(!funobj[funName]) return
  funobj[funName].limit -= 1
  const limit = funobj[funName].limit
  if(limit == 0 || limit <= 0) {
    if(funobj[funName]) funobj[funName].fun()
    delete funobj[funName]
  }
}